package com.wsc.springbootmultidevdemo.service.impl;

import com.wsc.springbootmultidevdemo.pojo.User;

/**
 * 异步任务线程
 */
public class AsyncTask1 implements Runnable {
    @Override
    public void run() {
        User user = new User();
        synchronized (user){
            try {
                for (int i = 0; i < 100 ; i++) {
                    System.out.println(Thread.currentThread().getName()+"========== 正在执行异步任务 >"+i+" ==========");
                    user.wait(200);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
